<?php
/**
 * Created by PhpStorm.
 * User: hui
 * Date: 2017/2/23
 * Time: 18:33
 */
namespace app\admin\controller;

use think\Controller;
use think\Hook;

class Base extends Controller
{
    public function _initialize()
    {
        parent::_initialize();
        //如果当前页面不是登录页面，就检查是否登录
        $route = 'admin/index/login';
        if (request()->routeInfo()['route'] != $route){
            if (empty(session('admin'))) {
                $this->redirect(url('/admin/login'));
            }
        }
    }
}